﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//
using ddcCajamarca.BusinessEntities.Post;
using System.Data.Entity.ModelConfiguration;
using System.ComponentModel.DataAnnotations.Schema;

namespace ddcCajamarca.Repository.Mapping
{
    public class ComentarioMap: EntityTypeConfiguration<Comentario>
    {
        public ComentarioMap()
        {
            this.HasKey(c => c.id);
            this.Property(c => c.id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            this.Property(c => c.texto).IsRequired();
            this.HasRequired(c => c.NotaInformativas).WithMany(n => n.Comentarios).
                HasForeignKey(c => c.idNotaInformativa).WillCascadeOnDelete(true);

        }
    }
}
